﻿/*
 * Copyright 2010 Pieter De Rycke
 *
 * This file is part of Frozen Bubble XNA.
 *
 * Frozen Bubble XNA is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2, as published by the Free Software Foundation.
 *
 * Frozen Bubble XNA is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with Frozen Bubble XNA. If not, see 
 * <http://www.gnu.org/licenses/>.
 *
 * Artwork:
 *    Alexis Younes <73lab at free.fr>
 *      (everything but the bubbles)
 *    Amaury Amblard-Ladurantie <amaury at linuxfr.org>
 *      (the bubbles)
 *
 * Soundtrack:
 *    Matthias Le Bidan <matthias.le_bidan at caramail.com>
 *      (the three musics and all the sound effects)
 *
 * Design & Programming:
 *    Guillaume Cottenceau <guillaume.cottenceau at free.fr>
 *      (design and manage the project, whole Perl sourcecode)
 *
 * XNA and Windows Phone 7 port:
 *    Pieter De Rycke
 *
 * Websites:
 *    http://www.frozen-bubble.org/
 *    http://pieterderycke.wordpress.com/
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.IO;
using System.Xml.Linq;

namespace FrozenBubble
{
    public class Configuration
    {
        //private Assembly _assembly;
        private bool _showRaster;
        private double _scale;
        private string _dimensionsClass;

        public Configuration()
        {
            //_assembly = Assembly.GetExecutingAssembly(); 
            //LoadFromAssembly();
        }

        #region Properties

        public bool IsRasterVisible
        {
            get
            {
                return false;
            }
        }

        public double Scale
        {
            get
            {
                return 1.0;
            }
        }

        //public string DimensionsClassName
        //{
        //    get
        //    {
        //        return _dimensionsClass;
        //    }
        //}

        public IPlayerDimensions PlayerDimensions
        {
            get
            {
#if WINDOWS_PHONE
                return new WindowsPhonePlayerDimensions();
#else
                return new WindowsSinglePlayerDimensions()
#endif
            }
        }

        #endregion

        #region Private Methods

//        private void LoadFromAssembly()
//        {
//            Assembly assembly = Assembly.GetExecutingAssembly();

//#if WINDOWS_PHONE
//            using (StreamReader reader =
//                new StreamReader(assembly.GetManifestResourceStream("FrozenBubble.config.wp7.xml")))
//#else
//            using (StreamReader reader =
//                new StreamReader(assembly.GetManifestResourceStream("FrozenBubble.config.xml")))
//#endif
//            {
//                XDocument xdoc = XDocument.Load(reader);

//                XElement root = xdoc.Element("frozenbubble");
//                XElement graphics = root.Element("graphics");

//                bool.TryParse(graphics.Element("raster").Value, out _showRaster);
//                if (!double.TryParse(graphics.Element("scale").Value, out _scale))
//                    _scale = 1.0;   //Default scale

//                _dimensionsClass = root.Element("dimensions").Value;

//                reader.Close();
//            }
//        }

        #endregion
    }
}
